<?php
/**
 * $Id: IndexController.php 423 2008-05-30 14:42:41Z dakl $
 * Strona glowna
 *
 */
class DefaultController extends MainController implements ControllerInterface {
	/**
	 * Lista
	 *
	 */
	public function ReadAction($param) {
	    
	    $this->AddSpryScript('includes/xpath.js');
	    $this->AddSpryScript('includes/SpryData.js');
	    $this->AddSpryScript('includes/SpryNestedXMLDataSet.js');
	    $this->AddSpryScript('includes/SpryPagedView.js');
	    
	    
	    
	    //elementy obiektu do pobrania
	    $classObjName = key($param);
	    
	    $classObj = new $classObjName();
	    

	    //pobieranie danych z crud controllera
	    $this->addXmlDataSet(key($param),  Router::GenerateUrl('crudRead', array('Crud' => 'Read','module' => key($param))),'data/' . strtolower(key($param)), $classObj->getPathArray());
	    
	    
	}
	/**
	 * Usuwanie
	 *
	 */
	public function DeleteAction($param) {
	
	    $this->AddSpryScript('includes/xpath.js');
	    $this->AddSpryScript('includes/SpryData.js');
	    $this->AddSpryScript('includes/SpryPagedView.js');
	    
	    
	    //pobieranie danych z crud controllera
	    $this->addXmlDataSet(key($param),  Router::GenerateUrl('crudRead', array('Crud' => 'Delete','module' => key($param))),'data/' . strtolower(key($param)));
	    
	    
	}
	/**
	 * Dodawanie 
	 *
	 */
	public function CreateAction($param) {
		
	    $this->AddSpryScript('includes/xpath.js');
	    $this->AddSpryScript('includes/SpryData.js');
	    $this->AddSpryScript('includes/SpryPagedView.js');
	    
	    
	    //pobieranie danych z crud controllera
	    $this->addXmlDataSet(key($param),  Router::GenerateUrl('crudRead', array('Crud' => 'Create','module' => key($param))),'data/' . strtolower(key($param)));
	    
	}
	/**
	 * Edytowanie
	 *
	 */
	public function UpdateAction($param) {
	
	    $this->AddSpryScript('includes/xpath.js');
	    $this->AddSpryScript('includes/SpryData.js');
	    $this->AddSpryScript('includes/SpryPagedView.js');
	    
	    
	    //pobieranie danych z crud controllera
	    $this->addXmlDataSet(key($param),  Router::GenerateUrl('crudRead', array('Crud' => 'Update','module' => key($param))),'data/' . strtolower(key($param)));
	    
	}	
	/**
	 * Metoda wspolna
	 *
	 */
	public function preDispatch($param) {
		//$this->RunShared('Auth');
		$this->Run();
        
	}
	/**
	 * 
	 *
	 */
	public function postDispatch($param) {
	}
}
